/*   _________  __  ____________  ___   ___  ____
 *  / ___/ __ \/  |/  /_  __/ _ \/ _ | / _ \/ __/
 * / /__/ /_/ / /|_/ / / / / , _/ __ |/ // / _/  
 * \___/\____/_/  /_/ /_/ /_/|_/_/ |_/____/___/  
 * COMTRADE file parser
 * -------------------------------------------------------------------------
 * Copyright (C) 2013 - Ericson Norberto A Santos (ericsonnorberto@gmail.com)
 * Federal University Of Campina Grande - UFCG
 * 
 * Supports on IEEE Std C37.111-1999 COMTRADE-99 and IEEE Std C37.111-1991
 * COMTRADE-91 standards.
 * 
 * ABSTRACT:
 * A common format for data files and exchange medium used for the interchange
 * of various types of fault, test, or simulation data for electrical power
 * systems is defined. Sources of transient data are described, and the case of
 * diskettes as an exchange medium is recommended.
 * Issues of sampling rates, filters, and sample rate conversions for transient
 * data being exchanged are discussed. Files for data exchange are specified,
 * as is the organization of the data. A sample file is given.
 * 
 * License information:
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
*/
#ifndef COMTRADE_DEFINES_HPP
    #define COMTRADE_DEFINES_HPP

#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <cstdlib>
#include <stdio.h>
#include <sys/stat.h>

using namespace std;

/* Type of files */
#define COMTRADE_FILE_CFG                0
#define COMTRADE_FILE_INF                1
#define COMTRADE_FILE_HDR                2
#define COMTRADE_FILE_DAT                3

/* Bit manipulation */
#define COMTRADE_MAX_BIT             32767

/* Error codes */
#define ERROR_NO_ERROR                   0
#define ERROR_FILE_NOT_FOUND            -1
#define ERROR_OPEN_FILE                 -2
#define ERROR_UNKNOWN                   -9

/* COMTRADE cfg general information define */
#define cfg_data_station_name           10
#define cfg_data_rec_dev_id             11
#define cfg_data_rev_year               12

/* COMTRADE channel information */
#define cfg_data_ch_tt                  13
#define cfg_data_ch_ta                  14
#define cfg_data_ch_td                  15

/* COMTRADE analog channel information */
#define cfg_data_a_ch_Ac                16
#define cfg_data_a_ch_id                17
#define cfg_data_a_ch_phase             18
#define cfg_data_a_ch_ccbm              19
#define cfg_data_a_ch_units             20
#define cfg_data_a_ch_a                 21
#define cfg_data_a_ch_b                 22
#define cfg_data_a_ch_skew              23
#define cfg_data_a_ch_min               24
#define cfg_data_a_ch_max               25
#define cfg_data_a_ch_pri_v             26
#define cfg_data_a_ch_sec_v             27
#define cfg_data_a_ch_PS                28

/* COMTRADE digital channel information */
#define cfg_data_d_ch_Dn                29
#define cfg_data_d_ch_id                30
#define cfg_data_d_ch_phase             31
#define cfg_data_d_ch_ccbm              32
#define cfg_data_d_ch_nstate            33

/* COMTRADE line frequency information */
#define cfg_data_line_frequency         34

/* COMTRADE sample information */
#define cfg_data_nrates                 35

/* COMTRADE time stamp information */
#define cfg_data_samp                   36
#define cfg_data_endsamp                37

/* COMTRADE date and time information */
#define cfg_data_dt_dd                  38
#define cfg_data_dt_mm                  39
#define cfg_data_dt_yy                  40
#define cfg_data_hr_hh                  41
#define cfg_data_hr_mm                  42
#define cfg_data_hr_ss                  43
#define cfg_data_trig_dt_dd             44
#define cfg_data_trig_dt_mm             45
#define cfg_data_trig_dt_yy             46
#define cfg_data_trig_hr_hh             47
#define cfg_data_trig_hr_mm             48
#define cfg_data_trig_hr_ss             49

/* COMTRADE file type information */
#define cfg_data_file_type              50

/* COMTRADE time multiplier information */
#define cfg_data_timemult_factor        51

/* COMTRADE data file id and time sample */
#define dat_data_n                      52
#define dat_data_timestamp              53
#define dat_data_analog_channel         54
#define dat_data_digital_channel        55

/* COMTRADE inf file data */


/* COMTRADE hdr file data */

#endif
/* COMTRADE_DEFINES_HPP */